﻿@page "/DataSource/DataBaseConfig"
<PageTitle>数据库配置</PageTitle>
@inherits ComponentBaseDataCenter

<div>
    <h3>数据库配置</h3>

    <Table TItem="DataBaseConfigVO" UseInjectDataService="false" IsPagination="true" PageItemsSource="PageItems" DoubleClickToEdit="true"
           IsStriped="true" IsBordered="true" ShowSkeleton="true" IsMultipleSelect="true" ShowEmpty="true" ShowLoading="true" ShowColumnList="true"
           ShowToolbar="true" ShowExtendButtons="true"
           ShowSearch="true" ShowAdvancedSearch="false"
           AutoGenerateColumns="true" EditMode="EditMode.Popup"
           OnQueryAsync="QueryAsync" OnSaveAsync="@OnSaveAsync" OnDeleteAsync="OnDeleteAsync" ShowToastAfterSaveOrDeleteModel="false">

        <EditTemplate>
            <div class="row g-3 form-inline">
                <div class="col-12 col-sm-6">
                    <BootstrapInput @bind-Value="@context.Name" placeholder="不可为空，50字以内" maxlength="50" />
                </div>
                <div class="col-12 col-sm-6">
                    <Select @bind-Value="@context.Type" Items="@DbTypeItems" placeholder="不可为空，50字以内" maxlength="50" OnSelectedItemChanged="@(x=>OnSelectedItemChangedAsync(x,context))" />
                </div>
                <div class="col-12 col-sm-12">
                    <BootstrapInput @bind-Value="@context.ConnStr" placeholder="请输入连接字符串" @ref="bootstrapInput" />
                </div>
            </div>
        </EditTemplate>
        <RowButtonTemplate>
            <TableCellButton Color="Color.Info" Icon="fa-solid fa-pen" Text="测试连接" OnClick="@(()=>OnConnTestAsync(context))" IsAsync="true" />
        </RowButtonTemplate>
    </Table>
</div>